<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.bfl.ai/v1/flux-pro-1.1-ultra-finetuned",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'finetune_id' => 'my-finetune',
'user' => '<string>',
'finetune_strength' => 1.2,
'prompt' => 'A beautiful landscape with mountains and a lake',
'seed' => 42,
'aspect_ratio' => '16:9',
'safety_tolerance' => 2,
'output_format' => 'jpeg',
'image_prompt' => '<string>',
'image_prompt_strength' => 0.1,
'prompt_upsampling' => false,
'webhook_url' => '<string>',
'webhook_secret' => '<string>'
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"x-key: <api-key>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}